From: Keir Fraser Date: Thu, 17 Dec 2009 06:27:55 +0000 (+0000) Subject: Base paging support for HVM guests. X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~12874 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/success/%22http:/www.example.com/cgi/success?a=commitdiff_plain;h=35387f6582edb099b6feceb528d7f98ac0a99efc;p=xen.git Base paging support for HVM guests. This includes paging support for HVMOPs, HAP nested paging, and HVM map entry. In all cases, the page is paged in automatically and an error returned, indicating that the failed operation should be retried. Signed-off-by: Patrick Colp --- diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c index eb010013b4..c898ad69fb 100644 --- a/xen/arch/x86/hvm/hvm.c +++ b/xen/arch/x86/hvm/hvm.c @@ -940,6 +940,10 @@ bool_t hvm_hap_nested_page_fault(unsigned long gfn) return 1; } + /* Check if the page has been paged out */ + if ( p2m_is_paged(p2mt) || (p2mt == p2m_ram_paging_out) ) + p2m_mem_paging_populate(current->domain, gfn); + /* Log-dirty: mark the page dirty and let the guest write it again */ if ( paging_mode_log_dirty(current->domain) && p2m_is_ram(p2mt) && (p2mt != p2m_ram_ro) ) @@ -1315,6 +1319,11 @@ static void *hvm_map_entry(unsigned long va) pfec = PFEC_page_present; gfn = paging_gva_to_gfn(current, va, &pfec); mfn = mfn_x(gfn_to_mfn_current(gfn, &p2mt)); + if ( p2m_is_paging(p2mt) ) + { + p2m_mem_paging_populate(current->domain, gfn); + return NULL; + } if ( !p2m_is_ram(p2mt) ) { gdprintk(XENLOG_ERR, "Failed to look up descriptor table entry\n"); @@ -2948,6 +2957,13 @@ long do_hvm_op(unsigned long op, XEN_GUEST_HANDLE(void) arg) { p2m_type_t t; mfn_t mfn = gfn_to_mfn(d, pfn, &t); + if ( p2m_is_paging(t) ) + { + p2m_mem_paging_populate(d, pfn); + + rc = -EINVAL; + goto param_fail3; + } if ( mfn_x(mfn) != INVALID_MFN ) { paging_mark_dirty(d, mfn_x(mfn)); @@ -3001,6 +3017,13 @@ long do_hvm_op(unsigned long op, XEN_GUEST_HANDLE(void) arg) p2m_type_t nt; mfn_t mfn; mfn = gfn_to_mfn(d, pfn, &t); + if ( p2m_is_paging(t) ) + { + p2m_mem_paging_populate(d, pfn); + + rc = -EINVAL; + goto param_fail4; + } if ( p2m_is_grant(t) ) { gdprintk(XENLOG_WARNING,